<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ include file="/pages/inc/taglibs.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>项目列表</title>
	<%@ include file="/pages/inc/header.jsp" %>
</head>
<body>
<%@ include file="/pages/inc/common.jsp" %>
<%@ include file="/pages/inc/menu.jsp" %>
<div class="pts-main">
	<%@ include file="/pages/inc/nav_pm.jsp" %>
	<div class="pts-page-title"><span>我的项目</span></div>
	<div class="container-fluid">
		<div id="proshow" class="pts-list"></div>  
	</div>
</div>
<%@ include file="/pages/inc/footer.jsp" %>
<script type="text/javascript">  
window.onload = function showProInfo(){
	$.ajax({
		url: contextPath+"/codePackages/getProjectInfo",
		cache:false,
		async:false,
		success: function(data, textStatus, jqXHR){
			var html = "";
			for(var i=0; i<data.length; i++){
                html +='<div id="';
                html += data[i].projectId;
                html += '"class="pts-prjlist-items" onclick="changeProjectID('+ data[i].projectId+',\''+data[i].projectName+'\')">';
                html += '<span class="pts-prjlist-items-title">'+data[i].projectName+'</span>';
				html += '<br>项目经理：<c:out value="${jf_pts_user.userName}"/>';
				html += '<br>成员数：5';
                html += '</div>';
			}
            var divshow = $("#proshow");
            divshow.append(html);
            //添加项目列表点击事件
        	 $(".pts-prjlist-items").click(function(){
        		window.location.href = contextPath+"/serviceOrders"; 
        	}); 
		},
	});
	};


	function changeProjectID(projectId,projectName){
		$.ajax({
			url:"<c:url value='/login/changeCurrentProjectID'/>",
			cache:false,
			async:false,
			data:{"projectId":projectId,"projectName":projectName},
			success: function(data, textStatus, jqXHR){
				//window.location.href = contextPath+"/pTSservice"; 
			},
			error:function(){
				biz.alert("执行错误!");
			}
		});
    }
	
</script>
</body>
</html>
